package com.gemme.gemme.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.gemme.gemme.R;

public class PlatformView extends RelativeLayout {
    private Context context;
    public PlatformView(Context context) {
        this(context,null);
    }

    public PlatformView(Context context, AttributeSet attrs) {
        this(context, attrs,0);
    }

    public PlatformView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        this.context = context;
        initView();
    }

    private void initView() {
        LayoutInflater.from(context).inflate(R.layout.platform_view,this);
        View rl_control =  findViewById(R.id.rl_control);
        View ll_hide =  findViewById(R.id.ll_hide);
        ImageView iv_arrow = findViewById(R.id.iv_arrow);
        rl_control.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                int visibility = ll_hide.getVisibility();
                if(visibility == View.GONE){
                    ll_hide.setVisibility(VISIBLE);
                    iv_arrow.setBackgroundResource(R.drawable.arrow_down);
                }else{
                    ll_hide.setVisibility(GONE);
                    iv_arrow.setBackgroundResource(R.drawable.arrow_right);
                }
            }
        });
    }

}
